package com.request.toyexchange;

/*
 * 用户已完成的交换的记录
 */

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

import com.bjtu.toyexchange.R;

public class CompleteRequest extends Activity {
	private Button fanhui, che_toy1, che_toy2;
	private TextView sen_user, rec_user, sen_way, rece_way;
	private String username1, username2, phone1, phone2;
	
	
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.exch_record);
		
		//得到自己用户名
		Intent intent = this.getIntent();
		username2 = intent.getStringExtra("username");
		
		//得到发送申请者的用户名
		username1 = intent.getStringExtra("sender");
		
		//设置在自己用户名textview为用户名
		rec_user = (TextView)CompleteRequest.this.findViewById(R.id.exch_rece_rece_username);
		rec_user.setText(username2);
		
		//得到并设置对方用户名、手机号
		phone1 = "13810414402";
		phone2 = "13810414402";
		sen_user = (TextView)CompleteRequest.this.findViewById(R.id.exch_rece_sen_username);
		sen_user.setText(username1);
		sen_way = (TextView)CompleteRequest.this.findViewById(R.id.exch_rece_send_way);
		sen_way.setText(phone1);
		rece_way = (TextView)CompleteRequest.this.findViewById(R.id.exch_rece_rece_way);
		rece_way.setText(phone2);
		
		//查看对方玩具的按钮
		che_toy1 = (Button)findViewById(R.id.exch_rece_che_toy);
		che_toy1.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				Intent int2 = new Intent();
				int2.putExtra("username", username1);
				int2.setClass(CompleteRequest.this, CheckToyActivity.class);
				CompleteRequest.this.startActivity(int2);
			}
		});
		
		//查看自己玩具的按钮
		che_toy2 = (Button)findViewById(R.id.exch_rece_che_toy2);
		che_toy2.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				Intent int2 = new Intent();
				int2.putExtra("username", username2);
				int2.setClass(CompleteRequest.this, CheckToyActivity.class);
				CompleteRequest.this.startActivity(int2);
			}
		});
		
		//返回的按钮
		fanhui = (Button)findViewById(R.id.exch_rec_back);
		fanhui.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				CompleteRequest.this.finish();
			}
		});
	}
}
